1. Field of the Invention.
The present invention relates to online reorganization of a database, and more particularly, to a method for estimating the elapsed time required for a log apply process to complete during online reorganization of the database.
2. Description of Related Art.
Over time and with frequent use, databases often become disorganized. Accordingly, numerous attempts have been made to reorganize such databases. Reorganization of a database includes changing some aspect of the logical and/or physical arrangement of the database. Most database management systems (DBMS""s) provide some type of reorganizer utility.
Since many applications require 24xc3x977 availability of databases, there has been increasing demand to mini any outages caused by utilities such as reorganizers. An online reorganizer minimizes outages by performing most of its processing while other applications still have access to the database.
One technique for reorganizing databases online is described in U.S. Pat. No. 5,721,915, filed Jun. 1, 1995, by Gary Sockut et al., entitled xe2x80x9cInteraction Between Application of a Log and Maintenance of a Table That Maps Record Identifiers During Online Reorganization of a Databasexe2x80x9d, which is incorporated by reference herein. This patent describes a technique for reorganizing a table space, wherein data is copied from an old area to a new area in reorganized form and then log records are applied to the data in the new area. Throughout most of the reorganization, applications still have access through the DBMS"" normal facilities to read and write data to the old area. The DBMS also uses its normal facilities to record any modifications to the old area that occur into the log. Finally, at the end of the reorganization, the applications"" access is switched from the old area to the new area.
Nonetheless, applications cannot modify the data during certain phases of the reorganization. What is needed, then, is a system that allows the user to specify the maximum amount of time that applications can be excluded from the data (either completely or limited to read-only access), and only allow the reorganizer to proceed if it can perform its operations within the specified amount of time.
To overcome the limitations in the prior art described above, and to overcome other limitations that will become apparent upon reading and understanding the present specification, the present invention discloses a method, apparatus, and article of manufacture for performing online reorganization of a database. A reorganizer utility performs the online reorganization in a manner that provides applications with concurrent access to data during an iterative process of log apply operations to a shadow version of the data. The reorganizer continues this iterative process of log apply operations until an estimate of an elapsed time necessary to complete a last iteration is less than or equal to a user-specified maximum length of time that read-only (RO) access may be provided to the data. When this threshold is reached, the reorganizer performs the last iteration, which includes draining all applications making modifications to the data; allowing read-only access to the data, performing log apply operations against the shadow version of the data, and then switching all of the applications to the shadow data.